import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-24
 * Time: 12:17
 */
public class Demo1 {
    public static void main(String[] args) {
        //创建固定线程数量的线程池
        ExecutorService service = Executors.newFixedThreadPool(4);
        //线程数量动态变化的线程池
        ExecutorService service1 = Executors.newCachedThreadPool();
        //创建一个定期执行线程的线程池
        ExecutorService service2 = Executors.newScheduledThreadPool(4);
        //创建一个只有单线程的线程池
        ExecutorService service3 = Executors.newSingleThreadExecutor();
        //创建一个可并行执行的线程池
        ExecutorService service4 = Executors.newWorkStealingPool();
    }
}
